<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>路由规则</title>
	</head>
	<body>
	<script src="../js/vue.js" type="text/javascript" charset="utf-8"></script>
	<script src="../js/vue-router.js" type="text/javascript" charset="utf-8"></script>
		<div id="app">
			<!-- 会将这个标签解析为a标签
				to会解析为href
			 -->
			<router-link to="/user">用户信息</router-link>
			<router-link to="/dept">部门</router-link>
			<router-link to="/">默认</router-link>
			
			<router-view></router-view>
			
		<h1>路由的规则</h1>
		</div>
	</body>
	<template id="userd">
		<div id="">
			<h1>我是用户组件</h1>
		</div>
	</template>
	
	<template id="deptd">
		<div id="">
			<h1>我是部门组件</h1>
		</div>
	</template>
	<script>
	
	const user=	{
		template:"#userd"
	}
	
	const dept=	{
		template:"#deptd"
	}
	const router=new VueRouter({
		routes:[
			{
				path:"/",redirect:"/user"
			},
			{
				path:"/user",
				component:user
			},{
				path:"/dept",
				component:dept
			}
		]
		
	})
	const appp=new Vue({
		el:app,
		router
	})
	</script>
</html>
